import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '@/layout'
import { title } from '@/settings'

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [{
  //     path: 'dashboard',
  //     name: 'Dashboard',
  //     component: () => import('@/views/dashboard/index'),
  //     // meta: { title: '首页', icon: 'dashboard' }
  //     meta: { title: '首页', icon: 'el-icon-s-platform' }
  //   }]
  // },
   {
    path: '/',
    component: Layout,
    redirect: '/canlendar',
    children: [{
      path: 'canlendar',
      name: 'canlendar',
      component: () => import('@/views/canlander'),
      // meta: { title: '首页', icon: 'dashboard' }
      meta: { title: '学校简介', icon: 'el-icon-school' }
    }]
  },
  
  {
    path:'/dormitory',
    component:Layout,
    redirect:'/dormitory',
    name:'dormitory',  
    meta:{title:'',icon:'el-icon-update'},
    children:[
      {
        path:'dormitory',
        name:'Dormitry',
        component:()=>import('@/views/dormitory/dormitory.vue'),
        meta:{title:"宿舍环境",icon:'el-icon-s-home'}
      }
    ]
  },
  {
    path:'/policy',
    component:Layout,
    redirect:'/policy',
    name:'policy',  
    meta:{title:'',icon:'el-icon-update'},
    children:[
      {
        path:'policy',
        name:'Policy',
        component:()=>import('@/views/policy/index.vue'),
        meta:{title:"招生计划",icon:'el-icon-date'}
      }
    ]
  },
  // {
  //   path:'/major',
  //   component:Layout,
  //   redirect:'/major',
  //   name:'major',  
  //   meta:{title:'',icon:'el-icon-update'},
  //   children:[
  //     {
  //       path:'major',
  //       name:'Major',
  //       component:()=>import('@/views/major/index.vue'),
  //       meta:{title:"专业介绍",icon:'el-icon-service'}
  //     }
  //   ]
  // },
  
  {
    path: '/travel',
    component: Layout,
    redirect: '/dashboard',
    name: 'travel',
    meta: { title: "", icon: 'el-icon-s-tools' },
    children: [
      {
        path: 'index',
        name: 'AiHelperIndex',
        component: () => import('@/views/dashboard/index'),
        meta: { title: "云游校园", icon: 'el-icon-s-promotion' }
      }
    ]
  },
  
  // {
  //   path: '/notice',
  //   component: Layout,
  //   redirect: '/notice/notice1',
  //   name: 'notice',
  //   children: [
  //     {
  //       path: 'notice1',
  //       name: 'notice1',
  //       component: () => import('@/views/notice'),
  //       meta: { title: '校内通知', icon: 'el-icon-chat-dot-square' }
  //     }
  //   ]
  // },
  // {
  //   path: '/example',
  //   component: Layout,
  //   redirect: '/example',
  //   name: 'Example',
  //   meta: { title: '班级学生管理', icon: 'el-icon-folder-opened' },
  //   children: [
  //     {
  //       path: 'classes',
  //       name: 'Classes',
  //       component: () => import('@/views/classes'),
  //       meta: { title: '班级管理', icon: 'el-icon-menu' }
  //     },
  //     {
  //       path: 'student',
  //       name: 'Student',
  //       component: () => import('@/views/student'),
  //       meta: { title: '学生管理', icon: 'el-icon-user-solid' }
  //     },
     
  //   ]
  // }, 
  // {
  //   path: '/system',
  //   component: Layout,
  //   redirect: '/system',
  //   name: 'System',
  //   meta: { title: '系统信息管理', icon: 'el-icon-coin' },
  //   children: [
  //     {
  //       path: 'dept',
  //       name: 'Dept',
  //       component: () => import('@/views/dept'),
  //       meta: { title: '部门管理', icon: 'el-icon-menu' }
  //     },
  //     {
  //       path: 'emp',
  //       name: 'Emp',
  //       component: () => import('@/views/emp'),
  //       meta: { title: '教工管理', icon: 'el-icon-s-custom' }
  //     }
  //   ]
  // },

 
  // {
  //   path: '/report',
  //   component: Layout,
  //   redirect: '/report',
  //   name: 'Report',
  //   meta: { title: '数据统计管理', icon: 'el-icon-s-tools' },
  //   children: [
  //     {
  //       path: 'emp-report',
  //       name: 'emp-report',
  //       component: () => import('@/views/emp-report'),
  //       meta: { title: '教工信息统计', icon: 'el-icon-s-data' }
  //     },
  //     {
  //       path: 'student-report',
  //       name: 'student-report',
  //       component: () => import('@/views/student-report'),
  //       meta: { title: '学生信息统计', icon: 'el-icon-pie-chart' }
  //     }
  //   ]
  // },
  {
    path: '/Ai',
    component: Layout,
    redirect: '/Ai/index',
    name: 'AiHelper',
    meta: { title: "", icon: 'el-icon-s-tools' },
    children: [
      {
        path: 'index',
        name: 'AiHelperIndex',
        component: () => import('@/views/AiHelper'),
        meta: { title: "邑AI", icon: 'el-icon-service' }
      }
    ]
  },

 
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
